sysroot: Write symlinks before calling fsync(), then rename after
authorColin Walters <walters@verbum.org>
Tue, 13 Oct 2015 01:33:23 +0000 (21:33 -0400)
committerColin Walters <walters@verbum.org>
Sun, 25 Oct 2015 15:46:41 +0000 (11:46 -0400)
commit723705b803480dfd9c4090000ffc69fdafbb5c82
treecfb8d9d84f44a7cd6e7f8f1beb5d7e8ec46c7471
parent70c07a633802d05368fd2df4c16904db73019ac0
sysroot: Write symlinks before calling fsync(), then rename after

There might be a race here in that we create new symlink files *after*
calling `syncfs`, and they are not guaranteed to end up on disk.

Rework the code so that we create symlinks before, and then only
rename them after (and `fsync()` the directory for good measure).

Additional-fixes-by: Giuseppe Scrivano <gscrivan@redhat.com>
Tested-by: Giuseppe Scrivano <gscrivan@redhat.com>
This still needs verification that we're fixing a real bug; but I'm
fairly confident this won't make the fsync situation worse.

https://bugzilla.gnome.org/show_bug.cgi?id=755595
src/libostree/ostree-sysroot-deploy.c
src/libotutil/ot-gio-utils.c
src/libotutil/ot-gio-utils.h